package com.yeyks.common.annotation.validator;

import com.yeyks.common.annotation.StrNotEmpty;
import com.yeyks.common.annotation.util.DisposeStrUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author fuchangshuai
 * @date 2019/06/24 10:58
 */
public class StrValidator implements ConstraintValidator<StrNotEmpty, String> {
    @Override
    public void initialize(StrNotEmpty constraintAnnotation) {

    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        return DisposeStrUtils.strNotEmpty(value);
    }
}
